from gxl_ai_utils.utils import utils_file

en2cn_dict = {
  "FEAR": "恐惧",
  "ANGER": "愤怒",
  "HAPPY": "开心",
  "SAD": "悲伤",
  "SURPRISE": "惊讶",
  "DISGUST": "厌恶",
  "NEUTRAL": "中性"
}
emotion_file_dir, text_path, recursion = utils_file.do_get_commandline_param(3, ["emotion_file_dir", "text_path","recursion"])
recursion = True if recursion == "True" or recursion == "true" or recursion == "1" else False
emotion_file_list = utils_file.do_get_list_for_wav_dir(emotion_file_dir, suffix='emotion', recursive=recursion)
res_dict = {}
for emotion_file in emotion_file_list:
    emotion_file_name = utils_file.get_file_pure_name_from_path(emotion_file)
    info = utils_file.load_first_row_clean(emotion_file)
    if info in en2cn_dict:
        info = en2cn_dict[info]
    else:
        print("error emotion:", info)
        continue
    res_dict[emotion_file_name] = info

utils_file.write_dict_to_scp(res_dict, text_path)